<extend name="Config/base"/>

<block name="body">

<div id="center">
<div id="center_base" class="with-padding" style="padding: 20px">

    <h2>
        {:L('_PW_MODIFY_')}
    </h2>
    <div class="row">
        <div class="col-xs-8">
            <form id="changePasswordForm"  action="{:U('Ucenter/Config/doChangePassword')}" method="post" class="ajax-form form-horizontal">
                <div class="form-group">
                    <label for="inputOldPassword" class="col-xs-2 control-label">{:L('_PW_OLD_')}</label>

                    <div class="col-xs-10">
                        <input type="password" class="form-control" id="inputOldPassword" value="" name="old_password" placeholder="{:L('_PW_OLD_INPUT_')}">
                    </div>
                </div>

                <div class="form-group">
                    <label for="inputNewPassword" class="col-xs-2 control-label">{:L('_PW_NEW_')}</label>

                    <div class="col-xs-10">
                        <input type="password" class="form-control" id="inputNewPassword" value="" name="new_password" placeholder="{:L('_PW_NEW_INPUT_')}">
                    </div>
                </div>

                <div class="form-group">
                    <label for="inputConfirmPassword" class="col-xs-2 control-label">{:L('_PW_CONFIRM_')}</label>

                    <div class="col-xs-10">
                        <input type="password" class="form-control" id="inputConfirmPassword" value="" name="confirm_password" placeholder="{:L('_PW_CONFIRM_INPUT_')}">
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-sm-offset-2 col-xs-10">
                        <p class="text-danger" id="submitTip"></p>
                        <button type="submit" class="btn btn-primary">{:L('_PW_SAVE_')}</button>
                    </div>
                </div>
            </form>
        </div>
    </div>


</div>
</div>

</block>
<block name="script">
    <script>
        //检查两次输入的密码是否一致
        $(function(){
            $('#changePasswordForm').submit(function(e){
                var newPassword = $('#inputNewPassword').val();
                var confirmPassword = $('#inputConfirmPassword').val();
                if(newPassword != confirmPassword) {
                    toast.error("{:L('_PW_NOT_SAME_')}");
                    e.stopPropagation();
                    return false;
                }
            })
        })
    </script>
</block>